package com.managedbeans;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;

import com.bo.Etudiant;
import com.service.EtudiantService;


public class EtudiantController {

	private Etudiant etudiant;
	private List<Etudiant> listeEtudiants = new ArrayList<Etudiant>();
	private EtudiantService etudiantService;

	public EtudiantController() {
		System.out.println("Abbadi Mohammed");
	}

	@PostConstruct
	public void populate() {
		System.out.println("------>");
		listeEtudiants = etudiantService.getAll();
	}

	public String AllEtudiants() {
		listeEtudiants = etudiantService.getAll();
		return "listeEtudiants.xhtml";
	}

	public EtudiantService getEtudiantService() {
		return etudiantService;
	}

	public void setEtudiantService(EtudiantService etudiantService) {
		this.etudiantService = etudiantService;

	}

	public Etudiant getEtudiant() {
		return etudiant;
	}

	public void setEtudiant(Etudiant etudiant) {
		this.etudiant = etudiant;
	}

	public List<Etudiant> getListeEtudiants() {
		return listeEtudiants;
	}

	public void setListeEtudiants(List<Etudiant> listeEtudiants) {
		this.listeEtudiants = listeEtudiants;
	}

}
